package com.ftg.learn.chapter18;


import java.util.Arrays;
import java.util.List;

/**
 * @author KangJx
 * @date 2021/8/26
 */
public class LearnL02 {

    public static void main(String[] args) {
        List<Emp> list = Arrays.asList(new Emp(123,"abc"),new Emp(12,"def"));
        list.sort((x,y) ->{
            if(x.getSno() > y.getSno()){
                return 1;
            }else if(x.getSno() == y.getSno()){
                if(x.getSname().compareTo(y.getSname()) > 0){
                    return -1;
                }else{
                    return 1;
                }
            }else{
                return -1;
            }
        });
        list.forEach(System.out::println);
    }

}
